Kanzi 4.0.0-beta2
kanzi::Texture::CreateInfoRenderTarget Struct Reference

Texture creation parameters for texture that can be used as render target for 2D nodes. More...

#include <kanzi/core.ui/graphics2d/texture_create_info.hpp>

Inheritance diagram for kanzi::Texture::CreateInfoRenderTarget:
[legend]

Public Member Functions

 CreateInfoRenderTarget (size_t width, size_t height, GraphicsFormat format)
 Constructor for CreateInfoRenderTarget.
 
- Public Member Functions inherited from kanzi::Texture::CreateInfo2D
 CreateInfo2D (BitmapImageUniquePtr image)
 CreateInfo2D constructor for texture creation parameters, for creating a two dimensional texture that is initialized from an image.
 
 CreateInfo2D (Sampler::MipmapMode mipmaps, BitmapImageUniquePtr image)
 CreateInfo2D constructor that also takes in mipmap mode.
 
 CreateInfo2D (size_t width, size_t height, GraphicsFormat format)
 CreateInfo2D constructor for texture creation parameters, for creating a two dimensional texture with specified format and size.
 
- Public Member Functions inherited from kanzi::Texture::CreateInfo
Status adjust (const Renderer &renderer, string_view name)
 Validates and applies adjustments to some texture creation parameters in case of avoidable error conditions.
 
 CreateInfo ()=default
 Default constructor for texture create info.
 
int getFeatures (const Renderer &renderer) const
 Gets the graphics format features required by this create info structure.
 
void updateShapeAndFormatFromImages ()
 Use updateShapeAndFormatFromImages() to fill in format, width, height from images.
 
Status validate (const Renderer &renderer) const
 Perform validation of texture creation parameters.
 
Status validate (const Renderer &renderer, int features, string_view name) const
 Perform validation of texture creation parameters.
 
Status validate (const Renderer &renderer, string_view name) const
 Perform validation of texture creation parameters.
 

Additional Inherited Members

- Public Types inherited from kanzi::Texture::CreateInfo
enum  Status {
  StatusInvalidType , StatusTypeNotSupported , StatusInvalidRenderTargetMode , StatusInvalidImageCount ,
  StatusMissingImages , StatusImageMissingMipmaps , StatusInvalidImageSize , StatusInvalidMinimumSize ,
  StatusInvalidMaximumSize , StatusInvalidMipmapSize , StatusUnsupportedGraphicsFormat , StatusUnsupportedTextureFilter ,
  StatusInvalidFeatures , StatusUnsupportedMultisampleFilter , StatusUnsupportedMultisampleMipmaps , StatusUnsupportedMultisampleSamples ,
  StatusUnsupportedInternalRenderTargetSampleCount , StatusUnsupportedSampleCount , StatusImageFormatMismatch , StatusImageIncompatibleWithDevice ,
  StatusUnsupportedDepthComparisonMode , StatusValid
}
 Status tells if texture creation parameters can be used to create a texture. More...
 
enum class  Type {
  Image , Cubemap , RenderTarget , NativeImage ,
  CubemapRenderTarget
}
 Specifies the available texture types. More...
 
- Static Public Member Functions inherited from kanzi::Texture::CreateInfo
static CreateInfo createSubstitutePattern (const Renderer &renderer, TextureType type)
 Create a texture create info structure for a black 1x1 texture.
 
- Public Attributes inherited from kanzi::Texture::CreateInfo
Sampler::AddressingMode addressingMode
 Texture addressing mode.
 
float anisotropy
 Texture anisotropy.
 
size_t depth
 Reserved for future use.
 
GraphicsCompareFunction depthCompareFunction
 Depth comparison function.
 
GraphicsFormat depthStencilFormat
 DepthStencil format.
 
GraphicsFormat format
 Format for texture.
 
size_t height
 Height for the base level of texture.
 
unsigned int heightDivisor
 Automatic size determination divisor for height, 0 when not automatic.
 
vector< BitmapImageSharedPtrimages
 Images that are used to create the texture.
 
Sampler::Filter magnificationFilter
 Texture minification filter.
 
float maxLod
 Reserved for future use.
 
MemoryType memoryType
 Memory type for the texture.
 
Sampler::Filter minificationFilter
 Texture magnification filter.
 
float minLod
 Reserved for future use.
 
float mipLodBias
 Reserved for future use.
 
size_t mipmapLevelCount
 Number of mipmap levels for the texture.
 
Sampler::MipmapMode mipmapMode
 Mipmap mode for the texture.
 
NativeDeploymentTarget nativeDeploymentTarget
 Native deployment target to use for memory storage if supported by the backend.
 
size_t renderTargetSampleCount
 Specifies number of samples for the draw renderbuffer when RenderTargetMode is RenderTargetModeExternal.
 
bool renderTargetTransient
 Indicates whether render target usage is transient.
 
TextureType type
 Texture type.
 
gfx::ImageUsageFlag usageFlags
 Usage for the texture.
 
size_t width
 Width for the base level of texture.
 
unsigned int widthDivisor
 Automatic size determination divisor for width, 0 when not automatic.
 
- Protected Member Functions inherited from kanzi::Texture::CreateInfo
Status validateFormat (const Renderer &renderer) const
 Validates texture format and features.
 
Status validateImages (const Renderer &renderer, int features) const
 Test if given set of images can be used to create Texture.
 
Status validateSize (const Renderer &renderer) const
 Validates texture size against minimum valid texture size (1x1) and maximum supported by graphics adapter.
 
Status validateTargetCompatibility (const Renderer &renderer) const
 Checks for known device incompatibilities, for example with texture formats and size.
 

Detailed Description

Texture creation parameters for texture that can be used as render target for 2D nodes.

You can use the resulting texture as content in Image2D nodes or texture brushes. You can also use resulting texture in materials for 3D rendering or material brushes.

Constructor & Destructor Documentation

◆ CreateInfoRenderTarget()

kanzi::Texture::CreateInfoRenderTarget::CreateInfoRenderTarget ( size_t width,
size_t height,
GraphicsFormat format )
explicit

Constructor for CreateInfoRenderTarget.

After the CreateInfoRenderTarget constructor:

  • Texture features is set to GraphicsFormatFeatureSampledImage and then OR'd with GraphicsFormatFeatureColorAttachment or GraphicsFormatFeatureDepthStencilAttachment depending on format.
  • Texture rendertarget mode is set to RenderTargetModeInternal, so Node2d::RenderTargetProperty can use the resulting texture.

The following (from CreateInfo2D constructor) also applies:

  • Texture type is set to TypeTwoDimensional.
  • Texture size and format is set according to constructor parameters.

The following (from CreateInfo constructor) also applies:

  • Texture minification and magnification filter settings are set to FilterNearest.
  • Texture wrap mode is set to AddressingModeClamp, so texture will not repeat.
  • Texture mipmap mode is set to MipmapModeBase, and mipmapLevelCount is set to 1, so texture will have only base image, no mipmaps.
Note
After constructor, due to filter settings and lack of mipmaps, the resulting texture should only be used when texture content is shown without scaling. If resulting texture is shown with scaling, the result has noticeable aliasing. You can adjust settings in the create info structure after constructor before passing it to Texture::create() if default settings are not ideal for you.
Not all texture formats support rendering to (GraphicsFormatFeatureColorAttachment). Make sure you use texture format that your device supports rendering to.

When you create texture from CreateInfoRenderTarget, texture contents are initially undefined. Set texture as rendertarget for a node, and arrange node to be rendered before using the texture as content.

See also
Node2D::RenderTargetProperty
Node2D::OffscreenRenderingProperty
Parameters
widthWidth for the texture.
heightHeight for the texture.
formatFormat for the texture.
Since
Kanzi 4.0.0 changed the type of the width and height parameters to size_t.

The documentation for this struct was generated from the following file: